package clang.control;

import clang.data.VarType;
import clang.data.Variable;

public class ReturnStatement implements CodeElement {

	private Variable retVal;
	
	public ReturnStatement()
	{
		retVal = new Variable(VarType.VOID);
	}
	
	public ReturnStatement(Variable var)
	{
		retVal = var;
	}
	
	public ReturnStatement(int r)
	{
		retVal = new Variable(VarType.INT, r);
	}
	
	@Override
	public void execute() throws Exception {
		ExecutionThread.get().getCurrentFunction().getBlock().endBlock(retVal);
	}

}
